<template>
  <!-- 承运商对账的创建、编辑、详情页 -->
  <div class="detailContainer">
    <div class="searchContainer">
      <el-form ref="form" :model="searchData" :inline="true">
        <el-form-item label="承运商名称" size="mini" style="width: 290px">
          <el-select
            disabled
            v-model="searchData.carrier_id"
            style="width: 200px"
          >
            <el-option
              v-for="carrier in carrierList"
              :key="carrier.id"
              :label="carrier.name"
              :value="carrier.id"
            />
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="联系电话" size="mini" style="width: 340px">
          <el-input
            :disabled="checkType === 'info'"
            v-model="searchData.carrier_phone"
            style="width: 200px"
          ></el-input>
        </el-form-item> -->
        <el-form-item label="创建人" size="mini" style="width: 160px">
          <el-select
            disabled
            v-model="searchData.creator_id"
            style="width: 100px"
          >
            <el-option
              v-for="creator in creatorList"
              :key="creator.id"
              :label="creator.nickname"
              :value="creator.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="创建时间" size="mini" style="width: 200px">
          <el-date-picker
            disabled
            value-format="timestamp"
            v-model="searchData.createTime"
            type="date"
            align="right"
            unlink-panels
            :picker-options="pickerOptions"
            style="width: 130px"
          />
        </el-form-item>
        <el-form-item label="实际对账单金额" size="mini" style="width: 310px">
          <el-input
            disabled
            v-model="noAccount"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="原对账单金额" size="mini" style="width: 310px">
          <el-input
            disabled
            v-model="alAccount"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="备注" size="mini">
          <el-input
            :disabled="checkType === 'info'"
            v-model="searchData.remark"
            style="width: 300px"
          ></el-input>
        </el-form-item>
        <el-form-item label="" size="mini">
          <el-button
            type="primary"
            @click="closeCheckPage"
            icon="el-icon-arrow-left"
            >返回</el-button
          >
        </el-form-item>
      </el-form>
    </div>

    <!-- 调账的表格 -->
    <!--       v-if="checkListFees[0].price !== ''" -->
    <el-table
      v-if="
        this.checkType == 'edit' ||
        (this.checkType == 'info' && checkListFees[0].price !== '')
      "
      ref="singleTable"
      :data="checkListFees"
      highlight-current-row
      style="width: 1000px; margin: 10px; margin-bottom: 0"
      border
    >
      <el-table-column
        property="type"
        label="对账单调整项"
        min-width="15%"
        key="11"
      >
        <template slot-scope="scope">
          <el-select
            v-model="scope.row.type"
            :disabled="disabledTime || account_adjust_money_switch == 0"
          >
            <el-option label="增加结算款" value="0"> </el-option>
            <el-option label="减少结算款" value="1"> </el-option>
          </el-select>
        </template>
      </el-table-column>
      <el-table-column property="price" label="调整金额" min-width="20%">
        <template slot-scope="scope">
          <el-input
            v-model="scope.row.price"
            :disabled="disabledTime || account_adjust_money_switch == 0"
            ><i
              slot="prefix"
              style="margin-top: 10px"
              :class="scope.row.type === '0' ? 'el-icon-plus' : 'el-icon-minus'"
            ></i
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column property="reason_type" label="调整原因" min-width="55%">
        <template slot-scope="scope">
          <el-select
            @change="selectAdjustReason(scope.row.reason_type, scope.$index)"
            v-model="scope.row.reason_type"
            :disabled="disabledTime || account_adjust_money_switch == 0"
          >
            <el-option label="我司填写错误" value="1"> </el-option>
            <el-option label="客户信息错误" value="2"> </el-option>
            <el-option label="客户折扣/承运商折扣" value="3"> </el-option>
            <el-option label="其他" value="4"> </el-option>
          </el-select>
          <el-input
            style="width: 300px; margin-left: 20px"
            v-if="scope.row.reason_type === '4'"
            v-model="scope.row.reason"
            :disabled="disabledTime"
            placeholder="请填写具体理由"
          ></el-input>
        </template>
      </el-table-column>
      <!-- 增加 -->
      <el-table-column
        width="100"
        v-if="account_adjust_money_switch == 1 && checkType !== 'info'"
        min-width="15%"
      >
        <template slot-scope="scope">
          <i
            @click="addOneLine"
            class="el-icon-circle-plus-outline"
            style="font-size: 26px"
          ></i>
          <i
            @click="deleteOneLine(scope.$index)"
            class="el-icon-remove-outline"
            style="font-size: 26px; margin-left: 10px"
          ></i>
        </template>
      </el-table-column>
    </el-table>

    <div style="height: 10px"></div>

    <el-tabs
      v-if="checkType !== 'add'"
      v-model="activeName"
      type="card"
      style="margin-left: 10px"
      @tab-click="showCheckLog"
    >
      <el-tab-pane label="承运商对账明细" name="first"></el-tab-pane>
      <el-tab-pane label="调账日志" name="second"></el-tab-pane>
    </el-tabs>

    <div
      v-if="activeName === 'first'"
      style="margin-left: 10px; padding-bottom: 50px"
    >
      <div class="operation">
        <el-button
          v-if="checkType !== 'info'"
          plain
          type="primary"
          @click="addCheckWaybill"
          style="float: left"
          >新增</el-button
        >
        <el-button
          v-if="checkType !== 'info'"
          plain
          type="primary"
          @click="deleteCheckWaybill"
          style="float: left"
          >删除</el-button
        >
        <!-- <el-button
          v-if="checkType === 'edit'"
          plain
          @click="modifyWaybillFees"
          type="primary"
          style="float: left"
          :disabled ="datadiable"
          >调整批次单金额
          </el-button> -->
        <el-tooltip
          class="item"
          effect="light"
          content="当对账单调整项的调整金额为空或者为0才能调整批次单金额"
          placement="top-start"
        >
          <el-button
            v-show="checkType === 'edit' && account_adjust_money_switch == 1"
            @click="modifyWaybillFees"
            type="primary"
            style="float: left"
            :disabled="datadiable"
            >调整批次单金额
          </el-button>
        </el-tooltip>
        <el-button
          v-if="checkType !== 'add'"
          plain
          type="primary"
          @click="outPut"
          style="float: left"
          v-permission="'finance_customer_carrier_export'"
          >导出</el-button
        >
      </div>

      <!-- 增加运单的弹出框 -->
      <el-dialog
        width="1100px"
        title="增加运单"
        :visible.sync="showNotCheckWaybills"
        :close-on-click-modal="false"
      >
        <div class="cutPages" style="margin-bottom: 10px">
          运单号：<el-input
            placeholder="输入运单号"
            v-model="waybill_number"
            style="width: 170px; margin-right: 20px"
          ></el-input>
          运单创建时间：<el-date-picker
            v-model="addCreateTime"
            type="daterange"
            align="right"
            unlink-panels
            :clearable="false"
            value-format="timestamp"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
            :default-time="['00:00:00', '23:59:59']"
            style="width: 220px"
          />
          <el-button
            plain
            type="primary"
            style="margin-left: 10px"
            @click="addCheckWaybill"
            >查询</el-button
          >
          <el-button
            plain
            type="primary"
            style="margin-left: 10px"
            @click="resettingData"
            >重置</el-button
          >
        </div>
        <el-table
          ref="singleTable"
          :data="spanVal"
          :row-key="(item) => `${item.relation_id}+${item.waybill_id}`"
          highlight-current-row
          @selection-change="handleSelectionAddWaybill"
          style="width: 100%"
          border
          :span-method="objectSpanMethod"
        >
          <el-table-column
            type="selection"
            width="45"
            :reserve-selection="true"
          >
          </el-table-column>
          <el-table-column prop="" fixed label="序号" width="50" type="index">
            <template slot-scope="scope">
              {{ scope.row.index }}
            </template>
          </el-table-column>
          <el-table-column prop="relation_no" fixed label="批次号" width="180">
          </el-table-column>
          <el-table-column prop="node_type" fixed label="批次类型" width="70">
            <template slot-scope="scope">
              {{
                scope.row.node_type === "1"
                  ? "揽收"
                  : scope.row.node_type === "2"
                  ? "干线"
                  : scope.row.node_type === "3"
                  ? "配送"
                  : scope.row.node_type === "4"
                  ? "回单"
                  : scope.row.node_type === "5"
                  ? "回箱"
                  : ""
              }}
            </template>
          </el-table-column>
          <el-table-column prop="carrier_number" label="承运单号" width="180">
          </el-table-column>
          <el-table-column
            prop="from_network_name"
            label="出发网点"
            width="100"
          >
          </el-table-column>
          <el-table-column prop="from_address" label="出发地址" width="300">
          </el-table-column>
          <el-table-column prop="to_network_name" label="目的网点" width="100">
          </el-table-column>
          <el-table-column prop="to_address" label="目的地址" width="300">
          </el-table-column>
          <el-table-column prop="number" label="件数" width="80">
          </el-table-column>
          <el-table-column prop="weight" label="重量(kg)" width="100">
          </el-table-column>
          <el-table-column prop="volume" label="体积(m³)" width="100">
          </el-table-column>
          <el-table-column prop="package_quantity" label="包装数量" width="80">
          </el-table-column>
          <el-table-column prop="waybill_no" label="运单号" width="180">
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="waybill_product_type"
            label="承运类型"
            width="100"
          >
          </el-table-column>
          <el-table-column
            prop="package_type_name"
            label="包装型号"
            width="100"
          >
          </el-table-column>
          <el-table-column prop="thermometer" label="订单温层" width="150">
          </el-table-column>
          <el-table-column
            prop="goods_thermometer"
            label="货物温层"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="single_waybill_expense"
            label="总费用(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="collect_money"
            label="揽收提货费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="package_money"
            label="揽收包装费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="handling_money"
            label="揽收装卸费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="delivery_money"
            label="揽收发货费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column prop="transport_fee" label="运输费(元)" width="150">
          </el-table-column>
          <el-table-column prop="delivery_fee" label="配送费(元)" width="150">
          </el-table-column>
          <el-table-column
            prop="extra_distribution_fee"
            label="配送里程费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="second_distribution_fee"
            label="二次配送费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="waiting_fee"
            label="配送专车费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="airport_pick_fee "
            label="机场提货费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column prop="dry_ice_fee " label="干冰费(元)" width="150">
          </el-table-column>
          <el-table-column
            prop="return_box_money "
            label="返箱费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="airport_operate_fee "
            label="机场操作费(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column prop="transfer_fee" label="中转费(元)" width="150">
          </el-table-column>
          <el-table-column
            prop="return_receipt_fee"
            label="回单费用(元)"
            width="150"
          >
          </el-table-column>
          <el-table-column
            prop="return_box_fee"
            label="回箱费用(元)"
            width="150"
          >
          </el-table-column>
        </el-table>
        <!-- <el-pagination
          style="float: right"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageNum"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="totalListNum"
        >
        </el-pagination> -->
        <div slot="footer" class="dialog-footer">
          <el-button @click="showNotCheckWaybills = false">取 消</el-button>
          <el-button type="primary" @click="pushInTable">确 定</el-button>
        </div>
      </el-dialog>

      <!-- 调整批次单金额的弹出框 -->
      <el-dialog
        title="调整批次单金额"
        width="800px"
        :visible.sync="changeWaybillFees"
        :close-on-click-modal="false"
      >
        <el-table
          v-if="NodeType === '1'"
          ref="singleTable"
          :data="adjustWaybillFee"
          highlight-current-row
          style="width: 100%"
          key="1"
          border
        >
          <el-table-column type="selection" width="45"> </el-table-column>
          <el-table-column
            prop=""
            fixed
            label="序号"
            width="50"
            type="index"
          ></el-table-column>
          <!-- <el-table-column prop="batch" fixed label="批次号" width="180">
          </el-table-column> -->
          <el-table-column prop="waybill_no" label="运单号" width="180" fixed>
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="collect_money" label="提货揽收费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.collect_money"></el-input>
            </template>
          </el-table-column>

          <el-table-column prop="package_money" label="揽收包装费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.package_money"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="handling_money" label="揽收装卸费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.handling_money"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="delivery_money" label="揽收发货费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.delivery_money"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop="airport_pick_money"
            label="揽收机场提货费"
            width="180"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.airport_pick_money"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="dry_ice_money" label="揽收干冰费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.dry_ice_money"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <el-table
          v-if="NodeType === '2'"
          ref="singleTable"
          :data="adjustWaybillFee"
          highlight-current-row
          style="width: 100%"
          key="2"
          border
        >
          <el-table-column type="selection" width="45"> </el-table-column>
          <el-table-column
            prop=""
            fixed
            label="序号"
            width="50"
            type="index"
          ></el-table-column>
          <!-- <el-table-column prop="batch" fixed label="批次号" width="180">
          </el-table-column> -->
          <el-table-column prop="waybill_no" label="运单号" width="180" fixed>
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="transport_fee" label="运输费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.transport_fee"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <el-table
          v-if="NodeType === '3'"
          ref="singleTable"
          :data="adjustWaybillFee"
          highlight-current-row
          style="width: 100%"
          key="3"
          border
        >
          <el-table-column type="selection" width="45"> </el-table-column>
          <el-table-column
            prop=""
            fixed
            label="序号"
            width="50"
            type="index"
          ></el-table-column>
          <!-- <el-table-column prop="batch" fixed label="批次号" width="180">
          </el-table-column> -->
          <el-table-column prop="waybill_no" label="运单号" width="180" fixed>
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="delivery_fee" label="配送费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.delivery_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop="extra_distribution_fee"
            label="配送里程费"
            width="180"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.extra_distribution_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop="second_distribution_fee"
            label="二次配送费"
            width="180"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.second_distribution_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="waiting_fee" label="配送专车费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.waiting_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop="airport_pick_fee"
            label="配送机场提货费"
            width="180"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.airport_pick_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="dry_ice_fee" label="配送干冰费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.dry_ice_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="return_box_money " label="返箱费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.return_box_money"></el-input>
            </template>
          </el-table-column>
          <el-table-column
            prop="airport_operate_fee "
            label="机场操作费"
            width="180"
          >
            <template slot-scope="scope">
              <el-input v-model="scope.row.airport_operate_fee"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="transfer_fee " label="中转费" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.transfer_fee"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <el-table
          v-if="NodeType === '4'"
          ref="singleTable"
          :data="adjustWaybillFee"
          highlight-current-row
          style="width: 70%"
          key="4"
          border
          :span-method="arraySpanMethodType"
        >
          <el-table-column type="selection" width="45"> </el-table-column>
          <el-table-column
            prop=""
            fixed
            label="序号"
            width="50"
            type="index"
          ></el-table-column>
          <!-- <el-table-column prop="batch" fixed label="批次号" width="180">
          </el-table-column> -->
          <el-table-column prop="waybill_no" label="运单号" fixed>
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
          <el-table-column prop="collect_money" label="回单费用" width="180">
            <template slot-scope="scope">
              <el-input v-model="scope.row.return_receipt_fee"></el-input>
            </template>
          </el-table-column>
        </el-table>
        <el-table
          v-if="NodeType === '5'"
          ref="singleTable"
          :data="adjustWaybillFee"
          highlight-current-row
          key="5"
          style="width: 100%"
          border
        >
          <el-table-column type="expand" width="80">
            <template slot-scope="scope">
              <el-table :data="scope.row.incubator_list">
                <el-table-column
                  prop=""
                  fixed
                  label="序号"
                  width="50"
                  type="index"
                ></el-table-column>
                <el-table-column label="保温箱类型" prop="incubator_type">
                  <template slot-scope="scope">
                    <span>{{
                      scope.row.incubator_type | incuType(Package_model)
                    }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="金额" prop="expense">
                  <template slot-scope="scope">
                    <el-input v-model="scope.row.expense"></el-input>
                  </template>
                </el-table-column>
              </el-table>
            </template>
          </el-table-column>
          <el-table-column type="selection" width="45"> </el-table-column>
          <el-table-column
            prop=""
            fixed
            label="序号"
            width="50"
            type="index"
          ></el-table-column>
          <el-table-column prop="waybill_no" label="运单号">
            <template slot-scope="scope">
              <div
                style="cursor: pointer; color: blue"
                @click="handleJump(scope)"
              >
                {{ scope.row.waybill_no }}
              </div>
            </template>
          </el-table-column>
        </el-table>
        <div style="display: flex; margin: 10px 0px 0px 0px">
          <div style="margin: 5px 5px 0px 0px">
            <span style="color: red">*</span>
            调整原因:
          </div>
          <div>
            <el-input
              type="textarea"
              :rows="1"
              placeholder="请输入内容"
              v-model="reasonList"
              style="width: 230%"
            ></el-input>
          </div>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button @click="changeWaybillFees = false">取 消</el-button>
          <el-button type="primary" @click="saveWaybillFees">确 定</el-button>
        </div>
      </el-dialog>

      <el-table
        ref="multipleTable"
        :data="tableData"
        @selection-change="handleSelectionChange"
        border
        align="center"
        style="width: 100%"
        max-height="450px"
        :span-method="objectSpanMethod"
      >
        <el-table-column type="selection" width="45"> </el-table-column>
        <el-table-column prop="index" fixed label="序号" width="50">
          <template slot-scope="scope">
            {{ scope.row.index_check }}
          </template>
        </el-table-column>
        <el-table-column prop="relation_no" fixed label="批次号" width="180">
        </el-table-column>
        <el-table-column prop="node_type" fixed label="批次类型" width="70">
          <template slot-scope="scope">
            {{
              scope.row.node_type === "1"
                ? "揽收"
                : scope.row.node_type === "2"
                ? "干线"
                : scope.row.node_type === "3"
                ? "配送"
                : scope.row.node_type === "4"
                ? "回单"
                : scope.row.node_type === "5"
                ? "回箱"
                : ""
            }}
          </template>
        </el-table-column>
        <!-- <el-table-column prop="carrier_number" label="承运单号" width="180"> 
        </el-table-column> -->
        <el-table-column prop="from_network_name" label="出发网点" width="100">
        </el-table-column>
        <el-table-column prop="from_address" label="出发地址" width="300">
        </el-table-column>
        <el-table-column prop="to_network_name" label="目的网点" width="100">
        </el-table-column>
        <el-table-column prop="to_address" label="目的地址" width="300">
        </el-table-column>
        <el-table-column prop="number" label="件数" width="80">
        </el-table-column>
        <el-table-column prop="weight" label="重量(kg)" width="100">
        </el-table-column>
        <el-table-column prop="volume" label="体积(m³)" width="100">
        </el-table-column>
        <el-table-column prop="package_quantity" label="包装数量" width="80">
        </el-table-column>
        <el-table-column prop="waybill_no" label="运单号" width="150">
          <template slot-scope="scope">
            <div
              style="cursor: pointer; color: blue"
              @click="handleJump(scope)"
            >
              {{ scope.row.waybill_no }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          prop="waybill_product_type"
          label="承运类型"
          width="120"
        >
        </el-table-column>
        <el-table-column prop="package_type_name" label="包装型号" width="100">
        </el-table-column>
        <el-table-column prop="thermometer" label="订单温层" width="150">
        </el-table-column>
        <el-table-column prop="goods_thermometer" label="货物温层" width="150">
        </el-table-column>
        <el-table-column
          prop="single_waybill_expense"
          label="总费用(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="collect_money"
          label="揽收提货费(元)"
          width="150"
        >
        </el-table-column>

        <el-table-column
          prop="package_money"
          label="揽收包装费(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="handling_money"
          label="揽收装卸费(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="delivery_money"
          label="揽收发货费(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="airport_pick_money"
          label="揽收机场提货费"
          width="150"
        >
        </el-table-column>
        <el-table-column prop="dry_ice_money" label="揽收干冰费" width="150">
        </el-table-column>
        <el-table-column prop="transport_fee" label="运输费(元)" width="150">
        </el-table-column>
        <el-table-column prop="delivery_fee" label="配送费(元)" width="150">
        </el-table-column>
        <el-table-column
          prop="extra_distribution_fee"
          label="配送里程费(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column
          prop="second_distribution_fee"
          label="二次配送费(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column prop="waiting_fee" label="配送专车费(元)" width="150">
        </el-table-column>
        <el-table-column
          prop="airport_pick_fee"
          label="配送机场提货费"
          width="150"
        >
        </el-table-column>
        <el-table-column prop="dry_ice_fee" label="配送干冰费" width="150">
        </el-table-column>
        <el-table-column prop="return_box_money" label="返箱费" width="150">
        </el-table-column>
        <el-table-column
          prop="airport_operate_fee"
          label="机场操作费"
          width="150"
        >
        </el-table-column>
        <el-table-column prop="transfer_fee" label="中转费" width="150">
        </el-table-column>
        <el-table-column
          prop="return_receipt_fee"
          label="回单费用(元)"
          width="150"
        >
        </el-table-column>
        <el-table-column prop="return_box_fee" label="回箱费用(元)" width="150">
        </el-table-column>
      </el-table>
    </div>
    <div v-if="activeName === 'second'" style="padding-bottom: 50px">
      <div class="logistics_nodes">
        <el-timeline style="padding: 0 20px" :reverse="true">
          <el-timeline-item
            v-for="(activity, index) in nodeData"
            :key="index"
            :timestamp="
              new Date(Number(activity.create_time) * 1000).toLocaleString()
            "
          >
            <span>{{ activity.content }}操作人：{{ activity.creator }}</span>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
    <div
      style="
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 20px 0;
        background-color: #fff;
        position: fixed;
        bottom: -20px;
        z-index: 100;
        padding: 10px 0;
      "
    >
      <el-button @click="closeCheckPage" style="margin-left: -200px"
        >关 闭</el-button
      >
      <el-button
        v-show="checkType !== 'info'"
        type="primary"
        @click="createCheckList"
        >{{ checkType === "add" ? "保 存" : "保 存" }}</el-button
      >
    </div>
  </div>
</template>

<script>
import tableForm from "@/components/table/table";
import pagination from "@/components/pagination";
import {
  reqCarrierSDetailList,
  toCheck,
  getCheckedDetailList,
  modifyCheckFees, //修改对账单金额
  modifyCarrierCheck, //修改对账单保存
  reqCustomerCheckLog,
  modifyCheckWaybillFees, //修改运单的金额
  reqCheckWaybillFees,
  reqOutPutCarrier, //导出对账单
} from "@/api/finance";
import { reqHandlersList } from "@/api/waybill";
import { dictionanryList } from "@/page/material/common/common";
import { settingList } from "@/api/print";

export default {
  name: "carrierCheckDetail",
  props: ["selectedDetails", "carrier_id", "createTime", "displayParentOrders"],
  data() {
    return {
      activeName: "first", //切换对账详情和调账日志的
      showNotCheckWaybills: false, //添加运单的弹出框
      changeCheckListFees: false, //调账的弹出框
      changeWaybillFees: false, //调整批次单金额的弹出框
      carrierList: [], //承运商名称
      creatorList: [], //创建人
      searchData: {
        carrier_id: "", //承运商id
        carrier_phone: "", //承运商电话
        creator_id: "", //创建人id
        createTime: new Date().getTime(), //创建时间
        remark: "",
      }, //查询条件
      alAccount: "", //原对账单金额
      noAccount: "", //实际对账单金额
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      // pageNum: 1, //目前在第几页
      // totalListNum: 10, //列表总数
      // pageSize: 10, //一页多少条
      //测试用
      tableData: [],
      notCheckWaybillList: [], //未对过账的运单列表
      waybill_number: "", //搜索运单号
      addCreateTime: "",
      checkListFees: [
        {
          type: "0", //增加或减少金额
          price: "", //金额多少
          reason_type: "", //调整原因
          reason: "",
        },
      ], //调整对账单的金额
      reasonList: "",
      selectedOrders: [], //选中的需要新增的运单
      selectedList: [], //选中的主table的运单
      adjustWaybillFee: [], //调整运单的金额
      carryInfo: {}, //承运的类型, 1揽收 2干线 3配送
      spanVal: [], //处理过的用于合并行的表格数据
      checkDetailInfo: {},
      nodeData: [], //调账日志数据
      Package_model: [], //包装型号
      NodeType: "",
      datadiable: false,
      adjustWaybillFeeOriginal: [],
      disabledTime: false,
      account_adjust_money_switch: "0",
    };
  },
  components: { tableForm, pagination },
  mounted() {
    this.lastMonthTimetamp();
    this.$store.commit("CHANGE_CHECK_TYPE", "");
    if (this.$store.getters.customerList.length === 0) {
      this.$store.dispatch("getCustomerList");
    }
    if (this.$store.getters.websiteList.length === 0) {
      this.$store.dispatch("getWebsiteList");
    }
    if (this.$store.getters.adminList.length === 0) {
      this.$store.dispatch("getAdminList");
    }
    if (this.$store.getters.carrierList.length === 0) {
      this.$store.dispatch("getCarrierList");
    }
    this.getHandlersList();
    this.getCarrierList();
    this.pagedictionanryList();
  },
  filters: {
    incuType(value, Package_model) {
      var name = "";
      Package_model.Package_model.forEach((itme) => {
        if (itme.item_code == value) {
          name = itme.item_name;
        }
      });
      return name;
    },
  },
  computed: {
    checkType() {
      console.log(
        this.$store.getters.checkType,
        "this.$store.getters.checkType"
      );
      return this.$store.getters.checkType;
    },
    justifyCheckFees() {
      //对账单调整的金额加总
      return this.checkListFees.reduce((pre, cur) => {
        if (cur.type === "0") {
          return pre + cur.price * 1;
        } else {
          return pre - cur.price * 1;
        }
      }, 0);
    },
  },
  watch: {
    selectedDetails() {
      // Object.assign(this.$data.searchData, this.$options.data().searchData);
      this.tableData = this.selectedDetails;
      if (this.checkType === "add" || this.checkType === "") {
        let sum = 0;
        this.tableData.forEach((item) => {
          //这里面原本的index是上个页面写死的index属性,要重新赋值一下index的值
          if (item.collapseNumber !== 0) {
            sum++;
          }
          this.$set(item, "index_check", sum); //操作单的索引
        });
        this.searchData.carrier_id = this.carrier_id * 1;
        this.searchData.carrier_phone = this.carrierList.find(
          (item) => item.id == this.carrier_id
        ).head_mobile;
        let total = 0;
        this.tableData.forEach((item) => {
          if (item.collapseNumber !== 0) {
            total += item.total_expenses * 1;
          }
        });
        this.noAccount = parseFloat(total).toFixed(2);
        this.alAccount = this.noAccount;
      }
    },
    checkListFees: {
      //调整对账单金额
      deep: true,
      handler(newVal, oldVal) {
        this.noAccount = this.alAccount * 1 + this.justifyCheckFees * 1; //在原对账金额的基础上加减
        this.noAccount = parseFloat(this.noAccount).toFixed(2);
      },
    },
    checkType() {
      if (this.checkType === "info" || this.checkType === "edit") {
        this.getCheckDetail();
        this.getSettingItem();
        this.disabledTime = this.checkType === "info" ? true : false;
      }
    },
    checkListFees: {
      deep: true,
      handler(newVal, oldVal) {
        console.log("函数先执行");
        this.datadiable = this.checkListFees.some(
          (itme) => itme.price !== "" && itme.price > 0
        );
      },
    },
  },
  methods: {
    async getSettingItem() {
      let result = await settingList({
        item_name: "account_adjust_money_users",
      });
      this.account_adjust_money_switch =
        JSON.parse(result.data.settings[0].item_info).indexOf(
          JSON.parse(localStorage.getItem("user")).user_id
        ) != -1;
    },
    async getCheckDetail() {
      //获取对账单详情
      let result = await getCheckedDetailList({
        id: this.$store.getters.checkDetailId,
      });
      if (result) {
        this.checkDetailInfo = result.data;
        this.tableData = this.checkDetailInfo.relations;
        this.searchData.carrier_id =
          this.checkDetailInfo.account_customer_id * 1;
        this.searchData.creator_id = this.checkDetailInfo.creator_id * 1;
        this.searchData.remark = this.checkDetailInfo.remark;
        this.searchData.createTime = this.checkDetailInfo.create_time * 1000;
        let total = 0;
        this.tableData.forEach((item, index) => {
          item.forEach((item2, index2) => {
            //item2是合并行里面的运单数据
            if (index2 === 0) {
              this.$set(item2, "collapseNumber", item.length); //应该合并几列
            } else {
              this.$set(item2, "collapseNumber", 0); //其余的不显示，标为0
            }
            this.$set(item2, "index_check", index + 1); //操作单的索引
          });
        });
        // setTimeout(() => {
        this.tableData = this.tableData.flat(2);
        this.alAccount = this.checkDetailInfo.old_price;
        this.noAccount = this.checkDetailInfo.now_price;

        if (this.checkDetailInfo.adjust_list.length !== 0) {
          this.checkListFees = this.checkDetailInfo.adjust_list;
          this.datadiable = true;
          // this.changeCheckListFees = true;
        } else {
          this.checkListFees = [
            {
              type: "0", //增加或减少金额
              price: "", //金额多少
              reason_type: "", //调整原因
              reason: "",
            },
          ];
        }
      } else {
        Object.assign(this.$data.searchData, this.$options.data().searchData);
        this.alAccount = "";
        this.noAccount = "";
        this.tableData = [];
      }
    },
    resettingData() {
      this.waybill_number = "";
      this.lastMonthTimetamp();
      this.addCheckWaybill();
    },
    async handleJump(scope) {
      //跳转到对应运单详情
      const checkedOrder = scope.row;
      const { waybill_id } = checkedOrder;
      let text = this.$router.resolve({
        name: "waybillDetail",
        query: { id: waybill_id, activeName: "1" },
      });
      window.open(text.href, "_blank");
    },
    async getCarrierList() {
      setTimeout(() => {
        this.carrierList = this.$store.getters.carrierList;
      }, 1000);
    },
    async getHandlersList() {
      let result = await reqHandlersList({ branch_id: "1" });
      this.creatorList = result.data;
      setTimeout(() => {
        this.searchData.creator_id =
          JSON.parse(localStorage.getItem("user")).user_id * 1;
      }, 100);
    },
    adjustCheckList() {
      //调账
      this.changeCheckListFees = true;
    },
    addOneLine() {
      this.checkListFees.push({
        type: "0", //增加或减少金额
        price: "", //金额多少
        reason_type: "", //调整原因
        reason: "",
      });
    },
    deleteOneLine(index) {
      if (this.checkListFees.length > 1) {
        this.checkListFees.splice(index, 1);
      } else if (this.checkListFees.length == 1) {
        this.checkListFees[0].price = "";
        this.checkListFees[0].type = "0";
        this.checkListFees[0].reason_type = "";
        this.checkListFees[0].reason = "";
      }
    },
    async addCheckWaybill() {
      this.showNotCheckWaybills = true;
      const { pageNum, pageSize, searchData } = this;
      let result = await reqCarrierSDetailList({
        carrier_id: String(this.carrier_id || this.searchData.carrier_id),
        waybill_no: String(this.waybill_number),
        status: "0", //0是未对账,1是已对账
        waybill_create_time: {
          start_time: (this.addCreateTime[0] + "").slice(0, 10),
          end_time: (this.addCreateTime[1] + "").slice(0, 10),
        },
        // start_time: (this.addCreateTime[0] + "").slice(0, 10),
        // end_time: (this.addCreateTime[1] + "").slice(0, 10),
        // page: String(pageNum),
        // page_size: String(pageSize),
      });
      if (result) {
        if (result.data.data) {
          this.notCheckWaybillList = result.data.data.list.filter(
            (x) => !this.tableData.some((item) => x.id === item.id)
          );
          // this.pageNum = result.data.pagination.page * 1;
          // this.totalListNum =
          //   result.data.pagination.total * 1 -
          //   (this.tableData.length -
          //     this.checkDetailInfo.relations.flat(2).length);
          // this.pageSize = result.data.pagination.page_size * 1;
          // if (this.notCheckWaybillList.length === 0 && this.totalListNum > 0) {
          //   this.pageNum = 2;
          //   this.addCheckWaybill();
          // }
        } //筛选出去之前添加进去的
        this.notCheckWaybillList.forEach((item, index) => {
          var param_id = [];
          item.forEach((item2, index2) => {
            param_id.push(item2.id);
            //item2是合并行里面的运单数据
            if (index2 === 0) {
              this.$set(item2, "collapseNumber", item.length); //应该合并几列
              this.$set(item2, "time_id", param_id); //应该合并几列
            } else {
              this.$set(item2, "collapseNumber", 0); //其余的不显示，标为0
              this.$set(item2, "time_id", param_id); //应该合并几列
            }
          });
        });
        this.spanVal = this.notCheckWaybillList
          .flat(2)
          .filter((x) => !this.tableData.some((item) => x.id === item.id));
        let sum = 0;
        this.spanVal.forEach((item, index) => {
          //这里面原本的index是上个页面写死的index属性,要重新赋值一下index的值
          if (item.collapseNumber !== 0) {
            sum++;
          }
          this.$set(item, "index", sum);
        });
      } else {
        this.$message({
          type: "error",
          message: result.message,
        });
      }
    },
    async pushInTable() {
      //将选中的单子加入table表格
      let total1 =
        this.noAccount * 1 +
        this.selectedOrders.reduce(
          (pre, cur) => pre + cur.total_expenses * 1,
          0
        );
      this.noAccount = parseFloat(total1).toFixed(2);
      let total2 =
        this.alAccount * 1 +
        this.selectedOrders.reduce(
          (pre, cur) => pre + cur.total_expenses * 1,
          0
        );
      this.alAccount = parseFloat(total2).toFixed(2);
      setTimeout(() => {
        this.tableData = this.tableData.concat(this.selectedOrders);
        let sum = 0;
        this.tableData.forEach((item) => {
          //这里面原本的index是上个页面写死的index属性,要重新赋值一下index的值
          if (item.collapseNumber !== 0) {
            sum++;
          }
          this.$set(item, "index_check", sum); //操作单的索引
        });
        this.showNotCheckWaybills = false;
      }, 500);
    },
    async deleteCheckWaybill() {
      //删除用于对账的运单,走更新对账单的接口
      let arr = this.tableData.filter(
        (x) =>
          !this.selectedList.some(
            (item) =>
              item.relation_id === x.relation_id &&
              item.node_type == x.node_type
          )
      );
      console.log(arr, "arrarr");
      if (this.checkType === "edit") {
        let result = await modifyCarrierCheck({
          id: String(this.$store.getters.checkDetailId),
          account_customer_id: String(this.searchData.carrier_id),
          type: "1", //客户承运商
          relation_ids: [...new Set(arr.map((item) => item.id * 1))],
        });
        if (result) {
          this.getCheckDetail();
        }
      } else {
        this.tableData = arr;
      }
      let sum = 0;
      this.tableData.forEach((item) => {
        //这里面原本的index是上个页面写死的index属性,要重新赋值一下index的值
        if (item.collapseNumber !== 0) {
          sum++;
        }
        // this.$set(item, "index_check", sum); //操作单的索引
        item.index_check = sum;
      });
      // console.log(this.tableData, "this.tableData");
    },
    async modifyWaybillFees() {
      console.log(this.selectedList, "this.selectedListthis.selectedList");
      if (this.selectedList.length === 1) {
        let result = await reqCheckWaybillFees({
          account_id: String(this.$store.getters.checkDetailId),
          relation_id: String(this.selectedList[0].relation_id),
          node_type: String(this.selectedList[0].node_type),
        });
        if (result.code === 10000) {
          this.carryInfo = result.data;
          this.adjustWaybillFee = result.data.relation_info;
          console.log(result.data.relation_info, "result.data.relation_info");
          this.adjustWaybillFeeOriginal = JSON.parse(
            JSON.stringify(result.data.relation_info)
          );
          // account_type 如果是1 是承运商  0 是客户
          if (this.carryInfo.account_type == 1) {
            this.NodeType = this.adjustWaybillFee[0].node_type;
          }
          this.changeWaybillFees = true;
        }
      } else {
        this.$message({
          type: "error",
          message: "选择一个运单进行调整",
        });
      }
    },
    async saveWaybillFees() {
      if (this.reasonList) {
        const newdata = this.compareArrays(
          this.adjustWaybillFee,
          this.adjustWaybillFeeOriginal
        );
        let result3 = await modifyCheckWaybillFees({
          //修改运单金额
          account_id: String(this.carryInfo.account_id),
          // relation_id: String(this.carryInfo.relation_id),
          node_type: String(this.NodeType),
          relation_expense: newdata,
          reason: this.reasonList,
          settle_type: String(0), //类型 0 对账单 1 报销调整
        });
        if (result3.code === 10000) {
          this.$message({
            type: "success",
            message: "调整成功",
          });
          this.getCheckDetail();
          this.changeWaybillFees = false;
        }
      } else {
        this.$message({
          type: "warning",
          message: "请输入调整原因",
        });
      }
    },
    handleSizeChange(val) {
      this.pageSize = val; //一页多少条
      this.addCheckWaybill();
    },
    handleCurrentChange(val) {
      this.pageNum = val; //第多少页
      this.addCheckWaybill();
    },
    handleSelectionChange(val) {
      //目前用于删除对账用的运单
      this.selectedList = val;
    },
    handleSelectionAddWaybill(val) {
      //选中需要新增的运单
      this.selectedOrders = this.spanVal.filter((x) =>
        val.some(
          (item) =>
            item.relation_id === x.relation_id && item.node_type == x.node_type
        )
      );
      console.log(
        this.selectedOrders,
        "this.selectedOrdersthis.selectedOrders"
      );
    },
    async createCheckList() {
      if (this.checkType === "add") {
        //创建对账单
        let arr = [];
        this.tableData.forEach((item) => {
          arr.push(item.id * 1);
        });
        let relation_ids = [...new Set(arr)];
        let result = await toCheck({
          account_customer_id: String(this.carrier_id), //客户id
          contact_person: "",
          contact_phone: "",
          type: "1", //代表承运商
          relation_ids: relation_ids,
          remark: this.searchData.remark,
        });
        if (result) {
          this.$message({
            type: "success",
            message: result.message,
          });
          this.$store.commit("GET_CHECK_DETAIL_ID", result.data.id);
          this.$router.push({
            name: "carrierreconciliation",
          });
          setTimeout(() => {
            this.$store.commit("CHANGE_CHECK_TYPE", "info");
          }, 200);
          this.getCheckDetail();
        }
      } else {
        let arr = this.tableData.map((item) => item.id * 1);
        let relation_ids = [...new Set(arr)];
        let checkoutTure = this.checkListFees.filter(
          (item) => item.price !== "" && item.price !== "0"
        );
        console.log(checkoutTure, "checkoutTure");
        let result = await modifyCarrierCheck({
          id: String(this.$store.getters.checkDetailId),
          account_customer_id: String(this.searchData.carrier_id),
          contact_person: "",
          contact_phone: "",
          type: "1", //客户承运商
          relation_ids: relation_ids,
          adjust_list: checkoutTure,
        });
        if (result) {
          this.$message({
            type: "success",
            message: "调整成功",
          });
          this.noAccount = result.data.now_price;
          this.alAccount = result.data.old_price;
          console.log(result, "resultresult");
        }
      }
    },
    closeCheckPage() {
      // console.log(
      //   this.$route.query.dataPage,
      //   "this.$route.querythis.$route.query"
      // );
      this.$parent.subcomponent();
      if (this.$route.query.dataPage != undefined) {
        if (this.$route.query.dataPage == 0) {
          this.$router.push({
            name: "thecarrierPays",
            query: { TageOpen: true },
          });
        } else if (this.$route.query.dataPage == 1) {
          // console.log("函数执行啦");
          this.$router.go(-1);
        } else {
          this.$router.go(-1);
        }
      } else {
        this.$store.commit("CHANGE_CHECK_TYPE", "");
        this.checkListFees = [
          {
            type: "0", //增加或减少金额
            price: "", //金额多少
            reason_type: "", //调整原因
            reason: "",
          },
        ];
      }
      // this.changeCheckListFees = false;
    },
    async showCheckLog() {
      if (this.activeName === "second") {
        let result = await reqCustomerCheckLog({
          account_id: String(this.$store.getters.checkDetailId),
        });
        this.nodeData = result.data;
      }
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (
        columnIndex === 0 ||
        columnIndex === 1 ||
        columnIndex === 2 ||
        columnIndex === 3 ||
        columnIndex === 4 ||
        columnIndex === 5
      ) {
        //列的index
        //当xxx的时候合并rowspan行0列
        if (row.collapseNumber > 0) {
          return {
            rowspan: row.collapseNumber,
            colspan: 1,
          };
        } else {
          return {
            //表示这一行不显示
            rowspan: 0,
            colspan: 0,
          };
        }
      }
    },
    // 数据字典
    pagedictionanryList() {
      // thermosphere 温度 humidity 湿度 delivery_method 送货方式 order_priority_level 紧急度
      // transport_way 运输方式 pay_way 付款方式  order_type 订单类型 cost 费用 Package_model 包装
      var param = ["Package_model"];
      dictionanryList(param).then((res) => {
        var res = res.data.list;
        this.Package_model = res; //
      });
    },
    arraySpanMethodType({ row, column, rowIndex, columnIndex }) {},
    selectAdjustReason(val, index) {
      if (val === "1") {
        this.checkListFees[index].reason = "我司填写错误";
      } else if (val === "2") {
        this.checkListFees[index].reason = "客户信息错误";
      } else if (val === "3") {
        this.checkListFees[index].reason = "客户折扣/承运商折扣";
      } else if (val === "4") {
        this.checkListFees[index].reason = "";
      }
    },
    async outPut() {
      let result = await reqOutPutCarrier({
        id: this.checkDetailInfo.id * 1,
      });
      if (result.code === 10000) {
        window.open("https://" + result.data.loaded_url, "_self");
        this.$message({
          type: "success",
          message: "导出成功",
        });
      } else {
        this.$message({
          type: "error",
          message: result.message,
        });
      }
    },
    lastMonthTimetamp() {
      //  一天的秒数
      const MillisecondsADay = 24 * 60 * 60;

      const date = new Date();
      date.setDate(1);
      date.setHours(0, 0, 0, 0);
      //  当月开始时间戳
      const timeStamp = date.getTime() / 1000;
      //  上个月的天数
      const days = this.lastMonthDats();
      //  上月开始时间戳
      const lastMonthStart = timeStamp - MillisecondsADay * days;
      //  上月结束时间戳
      const lastMonthEnd = timeStamp - 1;
      this.addCreateTime = [lastMonthStart * 1000, lastMonthEnd * 1000];
    },
    lastMonthDats() {
      const date = new Date();
      const year = date.getFullYear();
      //  上个月月份
      let month = date.getMonth() + 1 - 1; //  0-11 表示 1月-12月
      //  0 表示12月
      month = month || 12;
      //  30天的月份
      const arr30 = [4, 6, 9, 11];
      //  31天的月份
      const arr31 = [1, 3, 5, 7, 8, 10, 12];
      if (arr30.indexOf(month) !== -1) {
        //  上个月是 30 天
        return 30;
      } else if (arr31.indexOf(month) !== -1) {
        //  上个月是 31 天
        return 31;
      } else {
        //  2月
        if (this.isRunYear(year)) {
          return 29;
        } else {
          return 28;
        }
      }
    },
    isRunYear(year) {
      //  条件:能被4整除并且不能被100整除，或者被400整除的
      let flag = false;
      if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
        flag = true;
      }
      return flag;
    },
    compareArrays(arr1, arr2) {
      console.log(arr1, arr2);
      const result = [];
      for (let i = 0; i < arr1.length; i++) {
        const obj1 = arr1[i];
        const obj2 = arr2[i];
        for (const key in obj1) {
          if (obj1.hasOwnProperty(key) && obj2.hasOwnProperty(key)) {
            if (obj1[key] !== obj2[key]) {
              result.push(obj1);
              break;
            }
          }
        }
      }
      console.log(result);
      return result;
    },
  },
};
</script>

<style scoped lang="less">
/deep/ .el-tabs__header {
  margin: 0 0 10px !important;
}

.detailContainer {
  background-color: #fff;
  min-height: 85vh;

  .searchContainer {
    padding: 0 10px;
    padding-top: 15px;
    border-bottom: 7px solid #e8f1f7;

    .el-form-item--mini.el-form-item {
      margin-bottom: 10px;
    }
  }

  .el-tag {
    height: 30px;
    padding: 5px 30px;
    border-color: #92d6ff;
    background-color: #e6f7ff;

    span {
      font-weight: bold;
      color: black;
    }
  }

  .operation {
    // padding-top: 10px;
    height: 40px;

    ::v-deep .el-pagination {
      float: right;

      .el-input--mini .el-input__inner {
        height: 24px;
      }
    }
  }

  .remodername .number {
    height: 20px;
    display: block;
  }

  .remodername:hover .number {
    display: none;
  }

  .remodername .remodercenter {
    display: none;
    color: #ff0000;
  }

  .remodername:hover .remodercenter {
    height: 20px;
    display: block;
    color: #ff0000;
  }

  .dialog-footer {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .logistics_nodes {
    height: 90vh;
    overflow: scroll;
  }
}
</style>